
--header AssignmentReadModel Fix
if (exists(
select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'iComply'
and TABLE_NAME='AssignmentReadModel'))
begin
 drop table icomply.AssignmentReadModel
end

GO

create table iComply.AssignmentReadModel(
Id uniqueidentifier NOT NULL,
StartDate DateTime2 NOT NULL,
EndDate  DateTime2 NOT NULL,
EventDate DateTime2 NOT NULL,
OwnerId int NOT NULL,
IsAssignedByAdmin bit NOT NULL,
[Status]  tinyint NOT NULL,
FundId int NOT NULL,
FundName nvarchar(500) NOT NULL,
BookName nvarchar(500) NOT NULL,
SecurityName nvarchar(max) NOT NULL,
MaxSigmaMove float NOT NULL,
MaxTradeHeat float NOT NULL,
EventType nvarchar(500) NOT NULL,
SecurityId int NOT NULL,
[User] nvarchar(500) NOT NULL,
BookId int NOT NULL,
AlertIds nvarchar(500) NOT NULL,
        
CONSTRAINT PK_AssignmentReadModel PRIMARY KEY (Id)
 )

